Skip to content

meta: add next-env.d.ts to .gitignore#8819

Merged
ovflowd merged 2 commits intomainfrom
MattIPv4/ignore-next-env
Apr 14, 2026
Merged

meta: add next-env.d.ts to .gitignore#8819
ovflowd merged 2 commits intomainfrom
MattIPv4/ignore-next-env

Conversation

@MattIPv4
Copy link
Copy Markdown
Member

@MattIPv4 MattIPv4 commented Apr 14, 2026

Description

Folks frequently run into diffs being generated on next-env.d.ts locally when they run the site, and we've flip-flopped on the checked-in values a few times. I think it is easier to just ensure this file is never checked in, so it can contain whatever Next.js needs to generate for a person's local setup.

Next.js itself also recommends that this value is not checked in: https://nextjs.org/docs/app/api-reference/config/typescript#next-envdts + https://nextjs.org/docs/app/api-reference/cli/next#next-typegen-options

If you run next typegen or next build, you get this:

/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />
import "./.next/types/routes.d.ts";

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

But if you run next dev, you get this:

/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />
import "./.next/dev/types/routes.d.ts";

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

The import line changes...

Validation

File no longer checked in. CI still passes for type-checking.

Related Issues

N/A

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

@MattIPv4 MattIPv4 requested a review from a team as a code owner April 14, 2026 14:44
Copilot AI review requested due to automatic review settings April 14, 2026 14:44
@cursor
Copy link
Copy Markdown

cursor bot commented Apr 14, 2026

PR Summary

Low Risk
Low risk: this only affects repo hygiene and the type-checking command, with no runtime behavior changes.

Overview
Stops tracking Next.js-generated TypeScript env file by adding apps/site/next-env.d.ts to .gitignore and removing the committed file.

Updates apps/site’s lint:types script to run next typegen before tsc --noEmit, ensuring generated route/types are present during CI/local type checks.

Reviewed by Cursor Bugbot for commit ea533ab. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nodejs-org Ready Ready Preview Apr 14, 2026 2:44pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

👋 Codeowner Review Request

The following codeowners have been identified for the changed files:

Team reviewers: @nodejs/nodejs-website

Please review the changes when you have a chance. Thank you! 🙏

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.21%. Comparing base (b571fb7) to head (ea533ab).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8819      +/-   ##
==========================================
+ Coverage   74.20%   74.21%   +0.01%     
==========================================
  Files         104      104              
  Lines        8847     8847              
  Branches      329      329              
==========================================
+ Hits         6565     6566       +1     
+ Misses       2280     2279       -1     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the repo to stop tracking apps/site/next-env.d.ts (a locally-generated Next.js TypeScript env file that commonly produces noisy diffs) and adjusts type-linting to generate it as needed.

Changes:

  • Ignore apps/site/next-env.d.ts in .gitignore to prevent local Next.js-generated diffs from being committed.
  • Remove the checked-in apps/site/next-env.d.ts from the repository.
  • Update apps/site’s lint:types script to run next typegen before tsc --noEmit.

Reviewed changes

Copilot reviewed 1 out of 3 changed files in this pull request and generated no comments.

File Description
apps/site/package.json Runs next typegen as part of lint:types so type-checking remains reliable without a committed next-env.d.ts.
apps/site/next-env.d.ts Removes the previously committed generated file.
.gitignore Ensures the generated apps/site/next-env.d.ts is never tracked again.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

📦 Build Size Comparison

Summary

Metric Value
Old Total Size 3.51 MB
New Total Size 3.51 MB
Delta 0 B (0.00%)

Changes

➕ Added Assets (1)
Name Size
.next/static/chunks/3a4ee3cc36de6c5f.js 197.63 KB
➖ Removed Assets (1)
Name Size
.next/static/chunks/f3aaa1243d905236.js 197.63 KB

@MattIPv4 MattIPv4 changed the title chore: add next-env.d.ts to .gitignore meta: add next-env.d.ts to .gitignore Apr 14, 2026
Copy link
Copy Markdown
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM!

@ovflowd
Copy link
Copy Markdown
Member

ovflowd commented Apr 14, 2026

@nodejs/web-infra can we fast-track this?

@ovflowd ovflowd added this pull request to the merge queue Apr 14, 2026
Merged via the queue into main with commit b83294e Apr 14, 2026
20 checks passed
@ovflowd ovflowd deleted the MattIPv4/ignore-next-env branch April 14, 2026 15:17
@ovflowd
Copy link
Copy Markdown
Member

ovflowd commented Apr 14, 2026

@MattIPv4 did you ask for fast-tracking?

@MattIPv4
Copy link
Copy Markdown
Member Author

I hadn't no, but no qualms with you asking for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants